package facilius.controller.action.aula;

import facilius.model.ServiceLocator;
import facilius.model.pojo.Aula;
import facilius.util.TrataData;
import org.mentawai.core.BaseAction;

/**
 *
 * @author Graciano
 */
public class AulaUpdateAction extends BaseAction{

    @Override
    public String execute() throws Exception {
         String consequence = ERROR;
        try {

            String anexo1 = input.getString("anexo1");
            Aula aula = new Aula();
            aula.setId(input.getLong("id"));
            aula.setData(TrataData.stringToDate(input.getString("data")));
            aula.setDescricao(input.getString("descricao"));
            aula.setTitulo(input.getString("titulo"));
            aula.setTurma(ServiceLocator.getTurmaService().readById(input.getLong("turmaId")));
            
            ServiceLocator.getAulaService().update(aula);
            consequence = SUCCESS;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return consequence;
    }
}
